package guestbook;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

/*	
 *  this class was created to represent an instance of the Toto
 *  Results (x,1,2,2,x...) and winnings (money)
 */


@PersistenceCapable
public class totoResult extends abstractTotoObject {    
	   
	@Persistent   
	private String[] signs;
	@Persistent 
	private String[] winnings;

	public totoResult(String[] signs, String[] winnings) {        
		this.signs = signs;        
		this.winnings = winnings;
		}
	   
	public String[] getSigns() {        
		return signs;    
		}    
	public String[] getWinnings() {        
		return winnings;    
		}
		
	public void setSigns(String[] signs) {
		for (int i=0;i<16;i++){
			this.signs[i] = signs[i];  
		}
		  
		}    
	public void setWinnings(String[] winnings) {
		for (int i=0;i<5;i++){
			this.winnings[i] = winnings[i];   
		}    
	}
	
	/*
	 * this function writes this object (results+winnings) as a long string
	 * for the servlet
	 */
		
	public String toString(){
		String result="";
		for (int i=15;i>=0;i--){
			if (i!=0) result+=this.getSigns()[i]+"$";
			else result+=this.getSigns()[i];
		}
		
		result+="#";
		
		for (int i=4;i>=0;i--){
			if (i!=0) result+=this.getWinnings()[i]+"$";
			else result+=this.getWinnings()[i];
		}
				
		return result;		
		
	}
}